package com.xkcyy.study.spring.other;

import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * S_01_SpringFieldGenerics
 *
 * @author yuand
 * @date 2021/5/15
 **/
public class S_01_SpringFieldGenerics {
    private List<String> user = new ArrayList<>();


    public void test2() {
        Object a = 1;

        user.add((String) a);
    }

    @SneakyThrows
    @Test
    public void Test() {
        Field[] fields = S_01_SpringFieldGenerics.class.getDeclaredFields();
        Field user = fields[0];
        Type genericType = user.getGenericType();
    }
}
